package cos.android.tim.objects;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import cos.android.tim.element.Element;

public class Rope extends Element {

	Element element1;
	Element element2;
	Paint paint;
	float lenght;

	public Rope(Bitmap sprite, int xPos, int yPos, String kind) {
		super(sprite, sprite, sprite, xPos, yPos, kind);
		paint = new Paint();
		paint.setColor(Color.BLACK);
	}

	/*
	 * @Override public void draw(Canvas canvas) {
	 * 
	 * if (element1 != null && element2 != null) {
	 * canvas.drawLine(element1.extremePoint().getxPos(), element1
	 * .extremePoint().getyPos(), element2.extremePoint() .getxPos(),
	 * element2.extremePoint().getyPos(), paint); } }
	 */

	public void drawTemp(Canvas canvas, float x, float y) {
		canvas.drawLine(element1.extremePoint().getxPos(), element1
				.extremePoint().getyPos(), x, y, paint);
	}

	public Element getElement2() {
		return element2;
	}

	public void setElement2(Element element2) {
		this.element2 = element2;
	}

	public Element getElement1() {
		return element1;
	}

	public void setElement1(Element element1) {
		this.element1 = element1;
	}

	public boolean isTied() {
		return ((element1 != null) && (element2 != null));
	}

	public float getLenght() {
		return lenght;
	}

	public void setLenght(float lenght) {
		this.lenght = lenght;
	}
}
